user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

events {
  worker_connections 1024;
}

http {
  include /etc/nginx/mime.types;
  default_type application/octet-stream;

  log_format json '{'
  '"timestamp": "$time_iso8601", '
  '"host": "$host", '
  '"remote_addr": "$remote_addr", '
  '"remote_user": "$remote_user", '
  '"body_bytes_sent": "$body_bytes_sent", '
  '"request_time": "$request_time", '
  '"status": "$status", '
  '"request": "$request", '
  '"request_method": "$request_method", '
  '"http_referrer": "$http_referer", '
  '"http_x_forwarded_for": "$http_x_forwarded_for", '
  '"http_user_agent": "$http_user_agent"'
  '}';

  access_log /var/log/nginx/access.log json;
  sendfile on;
  keepalive_timeout 65;

  server {
    listen 80;
    server_name localhost;
    underscores_in_headers on;

    location / {
      root /app;
      index index.html;
      try_files $uri /index.html;
    }

    error_page 500 502 503 504 /50x.html;

    location = /50x.html {
      root /usr/share/nginx/html;
    }
  }
}
